<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<title>Operations - Macros</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../../styles/styles.css">
</head>

<body>

<h1>Operations</h1>
<div class="navbar">
<a href="../../index.html">main</a> |
<a href="../index.html">Macros</a> |
<a href="index.html">Macro-language</a>
</div>

<a name="op"></a>
<p>You can use the following operations on the variables:
<table class="cont">
  <tr class="cont">
    <th class="cont" width="40%">Operation</th>
    <th class="cont" width="60%">Description</th>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">+</td>
    <td class="cont" width="60%">Numeric addition or string concatenation</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">-</td>
    <td class="cont" width="60%">Numeric subtraction or unary negation</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">*</td>
    <td class="cont" width="60%">Numeric multiplication</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">/</td>
    <td class="cont" width="60%">Numeric division. FAR interrupts macro execution if division by 0 occurs.</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&amp;</td>
    <td class="cont" width="60%">Bitwise AND</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">^</td>
    <td class="cont" width="60%">Bitwise XOR</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">|</td>
    <td class="cont" width="60%">Bitwise OR</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&lt;&lt;</td>
    <td class="cont" width="60%">Logical left shift</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&gt;&gt;</td>
    <td class="cont" width="60%">Logical right shift</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">!</td>
    <td class="cont" width="60%">Logical NOT</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">~</td>
    <td class="cont" width="60%">Bitwise NOT</td>
  </tr>
</table>

<p>Operator precedence:
<table class="cont">
  <tr class="cont">
    <th class="cont" width="40%">Operation</th>
    <th class="cont" width="60%">Description</th>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">!  ~  -</td>
    <td class="cont" width="60%">Unary (R->L)</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">* /</td>
    <td class="cont" width="60%">Arithmetic</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">+ -</td>
    <td class="cont" width="60%">Arithmetic</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&lt;&lt; &gt;&gt;</td>
    <td class="cont" width="60%">Logical shift</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&lt;  &lt;=  &gt;  =&gt;</td>
    <td class="cont" width="60%">Logical comparison</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">== !=</td>
    <td class="cont" width="60%">Logical comparison</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&amp;</td>
    <td class="cont" width="60%">Bitwise (and)</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">^</td>
    <td class="cont" width="60%">Bitwise (xor)</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">|</td>
    <td class="cont" width="60%">Bitwise (or)</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">&amp;&amp;</td>
    <td class="cont" width="60%">Logical</td>
  </tr>
  <tr class="cont">
    <td class="cont" width="40%">||</td>
    <td class="cont" width="60%">Logical</td>
  </tr>
</table>

<h3>Notes</h3>
<div class=descr>
<ol>
<li>Named keys (e.g. CtrlK) can be present in any expressions; in this case they are treated as numbers.
<li>It is impossible to use macro-language elements while <a href="../macrokey/record.html">recording</a>
  a macro in a usual way. Macro-language elements can be added to the sequence only by editing
  the registry manually or by using special applications or FAR plugins.</li>
</ol>
</div>

</body>
</html>
